<template>
  <div class="img-wrap convention">
    <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/1.png">
    <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/2.png">
    <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/3.png">
    <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/4.png" @click='goToPage("https://g.eqxiu.com/s/1j72HGsm")'>
    <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/5.png">
    <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/6.png">
    <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/7.png" @click='goToPage("https://q.eqxiu.com/s/lGE1s42Z")'>
    <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/8.png">
    <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/9.png" @click='buy(30)'>
    <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/10.png" @click='checkCondition("1")'>
    <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/11.png">
    <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/12.png" @click='buy(60)'>
    <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/13.png" @click='checkCondition("2")'>
    <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/14.png">
    <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/15.png" @click='showPop=true'>
    <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/16.png" @click='checkCondition("3")'>
    <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/17.png">
    <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/18.png">
    <share-pop :show.sync="showPop"></share-pop>
  </div>
</template>
<script>
import { wxshare } from 'common/mixin';
import sharePop from "components/sharePop"
import { MessageBox } from 'mint-ui';

import { getCondition } from "api/activity"


export default {
  mixins: [wxshare],
  data() {
    return {
      showPop: false
    }

  },
  components: { sharePop },
  methods: {
    goToPage(href) {
      location.href = href;
    },
    buy(num) {
      this.$router.push({ path: 'orderPre', query: { num: num } });
    },
    checkCondition(id) {
      getCondition({ activityId: id }).then(res => {
        let data = res.data;
        let msg = '';
        if (data.success) {
          msg = `您已活动条件，请联系客服参加活动。`;
        } else if (id == '1') {
          if (data.supplementAmount) {
            msg = `您已拥有${data.credit}积分，你可补交${data.supplementAmount}元参加活动。`
          } else if (data.quantity) {
            msg = `您已购买${data.quantity}瓶，拥有${data.credit}积分，离方式一还差${data.lackQuantity}瓶。`
          } else {
            msg = `您尚未购买欧米咖3，请点击立即参与按钮参与活动。`
          }
        } else if (id == 2) {
          if (data.quantity) {
            msg = `您已购买${data.quantity}瓶，拥有${data.credit}积分，离方式二还差${data.lackQuantity}瓶。`
          } else {
            msg = `您尚未购买欧米咖3，请点击立即参与按钮参与活动。`
          }
        } else {
          if (data.credit) {
            msg = `您已拥有${data.credit}积分，离方式三还差${data.lackCredit}积分。`
          } else {
            msg = `您尚未成功推荐好友购买，请分享链接好友购买参加活动。`
          }
        }
        MessageBox.alert(msg, '温馨提示')
      })
    }
  }
}

</script>
<style lang="less">
.convention {
  img {
    vertical-align: top;
    display: block;
    width: 100%;
  }
}

</style>
